// To parse this JSON data, do
//
//     final goodsSpecialList = goodsSpecialListFromJson(jsonString);

import 'dart:convert';

//首发
class GoodsSpecialList {
  GoodsSpecialList({
    this.id,
    this.title,
    this.thumb,
    this.allCount,
    this.saleCount,
    this.basePrice,
    this.portrait,
    this.nickname,
    this.specialTypeName,
    this.type,
    this.num,
    this.specialTypeId,
    this.sellTime,
    this.isPresell,
    this.second,
    this.is_will_status,
  });

  String? id;
  String? title;
  String? thumb;
  int? allCount;
  int? saleCount;
  String? basePrice;
  String? portrait;
  String? nickname;
  String? specialTypeName;
  int? type;
  int? num;
  int? specialTypeId;
  String? sellTime;
  int? isPresell = 0;
  int? second = 0;
  int? is_will_status = 0;

  setSend(int se) {
    second = se;
  }

  factory GoodsSpecialList.fromRawJson(String str) =>
      GoodsSpecialList.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory GoodsSpecialList.fromJson(Map<String, dynamic> json) =>
      GoodsSpecialList(
        id: json["id"] == null ? null : json["id"].toString(),
        title: json["title"] == null ? null : json["title"].toString(),
        thumb: json["thumb"] == null ? null : json["thumb"].toString(),
        allCount: json["all_count"] == null ? null : json["all_count"],
        saleCount: json["sale_count"] == null ? null : json["sale_count"],
        basePrice:
            json["base_price"] == null ? null : json["base_price"].toString(),
        portrait: json["portrait"] == null ? null : json["portrait"].toString(),
        nickname: json["nickname"] == null ? null : json["nickname"].toString(),
        specialTypeName: json["special_type_name"] == null
            ? null
            : json["special_type_name"].toString(),
        type: json["type"] == null ? null : json["type"],
        num: json["num"] == null ? null : json["num"],
        specialTypeId:
            json["special_type_id"] == null ? null : json["special_type_id"],
        sellTime:
            json["sell_time"] == null ? null : json["sell_time"].toString(),
        isPresell: json["isPresell"] == null ? 0 : json["isPresell"],
        second: json["second"] == null ? 0 : json["second"]*1000,
        is_will_status:
            json["is_will_status"] == null ? 0 : json["is_will_status"],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "title": title == null ? null : title,
        "thumb": thumb == null ? null : thumb,
        "all_count": allCount == null ? null : allCount,
        "sale_count": saleCount == null ? null : saleCount,
        "base_price": basePrice == null ? null : basePrice,
        "portrait": portrait == null ? null : portrait,
        "nickname": nickname == null ? null : nickname,
        "special_type_name": specialTypeName == null ? null : specialTypeName,
        "type": type == null ? null : type,
        "num": num == null ? null : num,
        "special_type_id": specialTypeId == null ? null : specialTypeId,
        "sell_time": sellTime == null ? null : sellTime,
        "isPresell": isPresell == null ? 0 : isPresell,
        "second": second == null ? 0 : second,
        "is_will_status": is_will_status == null ? 0 : is_will_status,
      };
}

//转售列表
class GoodsList {
  GoodsList({
    this.id,
    this.price,
    this.status,
    this.code,
    this.contractAddress,
    this.createTime,
    this.type,
    this.allCount,
    this.specialTypeName,
    this.specialAlbumName,
    this.specialAlbumThumb,
    this.portrait,
    this.specialTypeId,
    this.nickname,
    this.num,
    this.title,
    this.thumb,
  });

  String? id;
  String? price;
  int? status; //状态: 0正在出售 1被买家锁定 2买家已支付 3卖家已经确认收款 4.超时 5收货 6已取消
  String? code;
  String? contractAddress;
  String? createTime;
  int? type;
  int? allCount;
  String? specialTypeName;
  String? specialAlbumName;
  String? specialAlbumThumb;
  String? portrait;
  String? nickname;
  int? specialTypeId;
  int? num;
  String? title; //商品名称
  String? thumb;

  factory GoodsList.fromRawJson(String str) =>
      GoodsList.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory GoodsList.fromJson(Map<String, dynamic> json) => GoodsList(
        id: json["id"] == null ? null : json["id"].toString(),
        price: json["price"] == null ? null : json["price"].toString(),
        status: json["status"] == null ? null : json["status"],
        code: json["code"] == null ? null : json["code"].toString(),
        contractAddress: json["contract_address"] == null
            ? null
            : json["contract_address"].toString(),
        createTime:
            json["create_time"] == null ? null : json["create_time"].toString(),
        type: json["type"] == null ? null : json["type"],
        allCount: json["all_count"] == null ? null : json["all_count"],
        specialTypeName: json["special_type_name"] == null
            ? null
            : json["special_type_name"].toString(),
        specialAlbumName: json["special_album_name"] == null
            ? null
            : json["special_album_name"].toString(),
        specialAlbumThumb: json["special_album_thumb"] == null
            ? null
            : json["special_album_thumb"].toString(),
        portrait: json["portrait"] == null ? null : json["portrait"].toString(),
        specialTypeId:
            json["special_type_id"] == null ? null : json["special_type_id"],
        nickname: json["nickname"] == null ? null : json["nickname"].toString(),
        num: json["num"] == null ? null : json["num"],
        // title: json["title"] == null ? null : json["title"].toString(),
        title: json["goods_title"] == null ? null : json["goods_title"].toString(),
        thumb: json["thumb"] == null ? null : json["thumb"].toString(),
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "price": price == null ? null : price,
        "status": status == null ? null : status,
        "code": code == null ? null : code,
        "contract_address": contractAddress == null ? null : contractAddress,
        "create_time": createTime == null ? null : createTime,
        "type": type == null ? null : type,
        "all_count": allCount == null ? null : allCount,
        "special_type_name": specialTypeName == null ? null : specialTypeName,
        "special_album_name":
            specialAlbumName == null ? null : specialAlbumName,
        "special_album_thumb":
            specialAlbumThumb == null ? null : specialAlbumThumb,
        "portrait": portrait == null ? null : portrait,
        "special_type_id": specialTypeId == null ? null : specialTypeId,
        "nickname": nickname == null ? null : nickname,
        "num": num == null ? null : num,
        "title": title == null ? null : title,
        "thumb": thumb == null ? null : thumb,
      };
}

//藏品详情
class GoodsInfo {
  GoodsInfo({
    this.info,
    this.orderList,
    this.shouMemberInfo,
  });

  Info? info;
  List<OrderList>? orderList;
  ShouMemberInfo? shouMemberInfo;

  factory GoodsInfo.fromRawJson(String str) =>
      GoodsInfo.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory GoodsInfo.fromJson(Map<String, dynamic> json) => GoodsInfo(
        info: json["info"] == null ? null : Info.fromJson(json["info"]),
        orderList: json["order_list"] == null
            ? null
            : List<OrderList>.from(
                json["order_list"].map((x) => OrderList.fromJson(x))),
        shouMemberInfo: json["shou_member_info"] == null
            ? null
            : ShouMemberInfo.fromJson(json["shou_member_info"]),
      );

  Map<String, dynamic> toJson() => {
        "info": info == null ? null : info!.toJson(),
        "order_list": orderList == null
            ? null
            : List<dynamic>.from(orderList!.map((x) => x.toJson())),
        "shou_member_info":
            shouMemberInfo == null ? null : shouMemberInfo!.toJson(),
      };
}

class Info {
  Info(
      {this.id,
      this.price,
      this.status,
      this.code,
      this.contractAddress,
      this.framerAccountAddress,
      this.createTime,
      this.type,
      this.allCount,
      this.detail,
      this.specialTypeName,
      this.specialAlbumName,
      this.specialAlbumThumb,
      this.framerMemberId,
      this.portrait,
      this.nickname,
      this.introduce,
      this.brandIntroduction,
      this.title,
      this.thumb,
      this.chainMark,
      this.castPrice,
      this.basePrice,
      this.saleCount,
      this.num,
      this.resourcesAddress,
      this.sellTime,
      this.accountAddress,
      this.isPresell,
      this.second,
      this.is_will_status});

  int? id;
  String? price;
  int? status;
  String? code; //商品编号
  String? contractAddress; //合约地址
  String? framerAccountAddress;
  String? createTime;
  int? type;
  int? allCount; //商品总数量
  String? framerMemberId;
  String? detail;
  String? specialTypeName; //商品类型
  String? specialAlbumName; //专辑名称
  String? specialAlbumThumb;
  String? portrait; //头像
  String? nickname; //创作者昵称
  String? introduce;
  String? brandIntroduction;
  String? title;
  String? thumb;
  String? chainMark;
  String? castPrice;
  String? basePrice;
  int? saleCount;
  int? num;
  String? resourcesAddress;
  String? sellTime;
  String? accountAddress;
  int? isPresell = 0;
  int? second = 0;
  int? is_will_status = 0;

  factory Info.fromRawJson(String str) => Info.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Info.fromJson(Map<String, dynamic> json) => Info(
        id: json["id"] == null ? null : json["id"],
        price: json["price"] == null ? null : json["price"],
        status: json["status"] == null ? null : json["status"],
        code: json["code"] == null ? null : json["code"],
        contractAddress:
            json["contract_address"] == null ? null : json["contract_address"],
        framerAccountAddress: json["framer_account_address"] == null
            ? null
            : json["framer_account_address"],
        createTime: json["create_time"] == null ? null : json["create_time"],
        type: json["type"] == null ? null : json["type"],
        allCount: json["all_count"] == null ? null : json["all_count"],
        detail: json["detail"] == null ? null : json["detail"],
        framerMemberId: json["framer_member_id"] == null
            ? null
            : json["framer_member_id"].toString(),
        specialTypeName: json["special_type_name"] == null
            ? null
            : json["special_type_name"],
        specialAlbumName: json["special_album_name"] == null
            ? null
            : json["special_album_name"],
        specialAlbumThumb: json["special_album_thumb"] == null
            ? null
            : json["special_album_thumb"],
        portrait: json["portrait"] == null ? null : json["portrait"],
        nickname: json["nickname"] == null ? null : json["nickname"],
        introduce: json["introduce"] == null ? null : json["introduce"],
        brandIntroduction: json["brand_introduction"] == null
            ? null
            : json["brand_introduction"],
        title: json["title"] == null ? null : json["title"],
        thumb: json["thumb"] == null ? null : json["thumb"],
        chainMark: json["chain_mark"] == null ? null : json["chain_mark"],
        castPrice: json["cast_price"] == null ? null : json["cast_price"],
        basePrice: json["base_price"] == null ? null : json["base_price"],
        saleCount: json["sale_count"] == null ? null : json["sale_count"],
        resourcesAddress: json["resources_address"] == null
            ? null
            : json["resources_address"].toString(),
        sellTime: json["sell_time"] == null ? null : json["sell_time"],
        num: json["num"] == null ? null : json["num"],
        accountAddress:
            json["account_address"] == null ? null : json["account_address"],
        isPresell: json["isPresell"] == null ? 0 : json["isPresell"],
        second: json["second"] == null ? 0 : json["second"],
        is_will_status:
            json["is_will_status"] == null ? 0 : json["is_will_status"],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "price": price == null ? null : price,
        "status": status == null ? null : status,
        "code": code == null ? null : code,
        "framer_member_id": framerMemberId == null ? null : framerMemberId,
        "contract_address": contractAddress == null ? null : contractAddress,
        "framer_account_address":
            framerAccountAddress == null ? null : framerAccountAddress,
        "create_time": createTime == null ? null : createTime,
        "type": type == null ? null : type,
        "all_count": allCount == null ? null : allCount,
        "detail": detail == null ? null : detail,
        "special_type_name": specialTypeName == null ? null : specialTypeName,
        "special_album_name":
            specialAlbumName == null ? null : specialAlbumName,
        "special_album_thumb":
            specialAlbumThumb == null ? null : specialAlbumThumb,
        "portrait": portrait == null ? null : portrait,
        "nickname": nickname == null ? null : nickname,
        "introduce": introduce == null ? null : introduce,
        "brand_introduction":
            brandIntroduction == null ? null : brandIntroduction,
        "title": title == null ? null : title,
        "thumb": thumb == null ? null : thumb,
        "chain_mark": chainMark == null ? null : chainMark,
        "cast_price": castPrice == null ? null : castPrice,
        "base_price": basePrice == null ? null : basePrice,
        "sale_count": saleCount == null ? null : saleCount,
        "num": num == null ? null : num,
        "resources_address": resourcesAddress == null ? null : resourcesAddress,
        "sell_time": sellTime == null ? null : sellTime,
        "account_address": accountAddress == null ? null : accountAddress,
        "isPresell": isPresell == null ? 0 : isPresell,
        "second": second == null ? 0 : second,
        "is_will_status": is_will_status == null ? 0 : is_will_status,
      };
}

class OrderList {
  OrderList({
    this.id,
    this.goodsId,
    this.memberId,
    this.specialId,
    this.content,
    this.type,
    this.nickname,
    this.createTime,
    this.title,
  });

  int? id;
  int? goodsId;
  int? memberId;
  int? specialId;
  String? content;
  int? type;
  String? nickname;
  String? createTime;
  String? title;

  factory OrderList.fromRawJson(String str) =>
      OrderList.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory OrderList.fromJson(Map<String, dynamic> json) => OrderList(
        id: json["id"] == null ? null : json["id"],
        goodsId: json["goods_id"] == null ? null : json["goods_id"],
        memberId: json["member_id"] == null ? null : json["member_id"],
        specialId: json["special_id"] == null ? null : json["special_id"],
        content: json["content"] == null ? null : json["content"],
        type: json["type"] == null ? null : json["type"],
        nickname: json["nickname"] == null ? null : json["nickname"],
        createTime: json["create_time"] == null ? null : json["create_time"],
        title: json["title"] == null ? null : json["title"],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "goods_id": goodsId == null ? null : goodsId,
        "member_id": memberId == null ? null : memberId,
        "special_id": specialId == null ? null : specialId,
        "content": content == null ? null : content,
        "type": type == null ? null : type,
        "nickname": nickname == null ? null : nickname,
        "create_time": createTime == null ? null : createTime,
        "title": title == null ? null : title,
      };
}

class ShouMemberInfo {
  ShouMemberInfo({
    this.portrait,
    this.nickname,
  });

  String? portrait;
  String? nickname;

  factory ShouMemberInfo.fromRawJson(String str) =>
      ShouMemberInfo.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory ShouMemberInfo.fromJson(Map<String, dynamic> json) => ShouMemberInfo(
        portrait: json["portrait"] == null ? null : json["portrait"],
        nickname: json["nickname"] == null ? null : json["nickname"],
      );

  Map<String, dynamic> toJson() => {
        "portrait": portrait == null ? null : portrait,
        "nickname": nickname == null ? null : nickname,
      };
}

class UserInfoModel {
  UserInfoModel({
    this.nickname,
    this.introduce,
    this.portrait,
    this.brandIntroduction,
    this.sellCount,
    this.allCount,
  });

  String? nickname;
  String? introduce;
  String? portrait;
  dynamic? brandIntroduction;
  String? sellCount;
  String? allCount;

  factory UserInfoModel.fromRawJson(String str) =>
      UserInfoModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
        nickname: json["nickname"] == null ? null : json["nickname"].toString(),
        introduce:
            json["introduce"] == null ? null : json["introduce"].toString(),
        portrait: json["portrait"] == null ? null : json["portrait"].toString(),
        brandIntroduction: json["brandIntroduction"] == null
            ? null
            : json["brandIntroduction"],
        sellCount:
            json["sell_count"] == null ? null : json["sell_count"].toString(),
        allCount:
            json["all_count"] == null ? null : json["all_count"].toString(),
      );

  Map<String, dynamic> toJson() => {
        "nickname": nickname == null ? null : nickname,
        "introduce": introduce == null ? null : introduce,
        "portrait": portrait == null ? null : portrait,
        "brandIntroduction":
            brandIntroduction == null ? null : brandIntroduction,
        "sell_count": sellCount == null ? null : sellCount,
        "all_count": allCount == null ? null : allCount,
      };
}
